﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using Jzy.Model;
using Frame.Lib.Core.User;
using Frame.Lib.Common;
using Frame.Lib.Utilities;


public partial class HumanResource_Employee_ModifyPwd : PageEdit
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        UserBO user = new UserBO();
        string strOld = txtOldPwd.Text.Trim();
        string strNew = txtNewPwd.Text.Trim();
        string strConfirm = txtConfirmPwd.Text.Trim();

        int userID = AppSession.UserID;
        string strLoginName = AppSession.LoginName;
        LoginResult result = user.CheckLogin(strLoginName, strOld);
        if (result == LoginResult.Success)
        {
            UserInfo info = user.GetInfo(userID);
            info.Password = strNew;
            user.ModifyPwd(info);
            
            JSUtil.Alert("修改成功！");
        }
        else
        {
            JSUtil.Alert("旧密码错误！");
        }
    }
}
